import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";

import path from "path";
// https://vitejs.dev/config/
export default defineConfig({
    plugins: [vue()],
    server: {
        host: "0.0.0.0",
        proxy: {
            "/web": {
                target: "http://47.122.40.115", //测试站
                changeOrigin: true,
                // rewrite: (path) => path.replace(/^\/api/, ""),
            },
            "/stage-api": {
                target: "http://47.122.40.115:8088", //测试站
                changeOrigin: true,
                // rewrite: (path) => path.replace(/^\/api/, ""),
            },
        },
        cors: true,
    },
    resolve: {
        alias: {
            // 设置路径 这里resolve和join可自行选用
            "~": path.resolve(__dirname, "./"),
            // 设置别名
            "@": path.resolve(__dirname, "./src"),
        },

        extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
    },
    css: {
        preprocessorOptions: {
            less: {
                modifyVars: {},
                javascriptEnabled: true,
            },
        },
    },
});
